package com.bbz.core.binarytree;

/**
 * 树节点
 * 
 * @author binbin.a.zhang
 *
 */
// 创建一个树的节点
// 每个node存放两个数据
// 一个左node引用和一个右node引用
public class Node {
	public int iData;
	public double dData;
	public Node leftNode;
	public Node rightNode;

	// 显示树节点信息
	public void showNode() {
		System.out.println("{ " + iData + "," + dData + " }");
	}

	public static void main(String args[]) {
		Tree tree = new Tree();
		tree.insert(3, 3.666);
		tree.insert(1, 1.111);
		tree.insert(2, 2.362);
		tree.insert(4, 4.672);
		tree.insert(5, 5.865);
		tree.insert(6, 6.681);
		Node node = tree.find(6);
		if (node == null) {
			System.out.println("we can not find it");
		} else {
			node.showNode();
		}
		// 查找tree中的最值
		Node[] temp = tree.mVal();
		temp[0].showNode();
		temp[1].showNode();
	}
}
